/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastroVoo.java
 *
 * Created on 27/06/2012, 20:18:17
 */
package skyuff;

import Controle.Agencia;

/**
 *
 * @author Máctassio
 */
public class CadastroVoo extends javax.swing.JFrame {

    /** Creates new form CadastroVoo */
    public CadastroVoo() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        partidaLabel = new javax.swing.JLabel();
        origem = new javax.swing.JTextField();
        chegadaLabel = new javax.swing.JLabel();
        chegada = new javax.swing.JTextField();
        vasgasLabel = new javax.swing.JLabel();
        vagas = new javax.swing.JTextField();
        escalaCheckBox = new javax.swing.JCheckBox();
        cadastroVooTextField = new javax.swing.JLabel();
        confirmaButton = new javax.swing.JButton();
        cancelaButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        numero = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(skyuff.SkyUFFApp.class).getContext().getResourceMap(CadastroVoo.class);
        partidaLabel.setText(resourceMap.getString("partidaLabel.text")); // NOI18N
        partidaLabel.setName("partidaLabel"); // NOI18N

        origem.setText(resourceMap.getString("origem.text")); // NOI18N
        origem.setName("origem"); // NOI18N

        chegadaLabel.setText(resourceMap.getString("chegadaLabel.text")); // NOI18N
        chegadaLabel.setName("chegadaLabel"); // NOI18N

        chegada.setText(resourceMap.getString("chegada.text")); // NOI18N
        chegada.setName("chegada"); // NOI18N

        vasgasLabel.setText(resourceMap.getString("vasgasLabel.text")); // NOI18N
        vasgasLabel.setName("vasgasLabel"); // NOI18N

        vagas.setText(resourceMap.getString("vagas.text")); // NOI18N
        vagas.setName("vagas"); // NOI18N

        escalaCheckBox.setText(resourceMap.getString("escalaCheckBox.text")); // NOI18N
        escalaCheckBox.setName("escalaCheckBox"); // NOI18N

        cadastroVooTextField.setText(resourceMap.getString("cadastroVooTextField.text")); // NOI18N
        cadastroVooTextField.setName("cadastroVooTextField"); // NOI18N

        confirmaButton.setText(resourceMap.getString("confirmaButton.text")); // NOI18N
        confirmaButton.setName("confirmaButton"); // NOI18N
        confirmaButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                confirmaButtonMouseClicked(evt);
            }
        });

        cancelaButton.setText(resourceMap.getString("cancelaButton.text")); // NOI18N
        cancelaButton.setName("cancelaButton"); // NOI18N
        cancelaButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cancelaButtonMouseClicked(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        numero.setText(resourceMap.getString("numero.text")); // NOI18N
        numero.setName("numero"); // NOI18N

        jButton1.setText(resourceMap.getString("voosButton.text")); // NOI18N
        jButton1.setName("voosButton"); // NOI18N
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(chegadaLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(chegada, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(escalaCheckBox)
                                    .addComponent(vasgasLabel))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(vagas, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(141, 141, 141)
                        .addComponent(cadastroVooTextField))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(confirmaButton)
                        .addGap(18, 18, 18)
                        .addComponent(cancelaButton)
                        .addGap(18, 18, 18)
                        .addComponent(jButton1))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(partidaLabel)
                            .addComponent(jLabel1))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(numero)
                            .addComponent(origem, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE))))
                .addGap(81, 81, 81))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(cadastroVooTextField)
                .addGap(25, 25, 25)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(numero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(partidaLabel)
                    .addComponent(origem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chegadaLabel)
                    .addComponent(chegada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(37, 37, 37)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vasgasLabel)
                    .addComponent(vagas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(escalaCheckBox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(confirmaButton)
                    .addComponent(cancelaButton)
                    .addComponent(jButton1))
                .addContainerGap(17, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void cancelaButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelaButtonMouseClicked
    this.dispose();
}//GEN-LAST:event_cancelaButtonMouseClicked

private void confirmaButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_confirmaButtonMouseClicked
 Agencia agencia = new Agencia();
 
    agencia.criarVoo(numero.getText(), origem.getText(), chegada.getText(), Integer.parseInt(vagas.getText()));
}//GEN-LAST:event_confirmaButtonMouseClicked

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        VisualizarVoo visualizarvoo = new VisualizarVoo();
        visualizarvoo.setVisible(true);
    }//GEN-LAST:event_jButton1MouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CadastroVoo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CadastroVoo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CadastroVoo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CadastroVoo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CadastroVoo().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel cadastroVooTextField;
    private javax.swing.JButton cancelaButton;
    private javax.swing.JTextField chegada;
    private javax.swing.JLabel chegadaLabel;
    private javax.swing.JButton confirmaButton;
    private javax.swing.JCheckBox escalaCheckBox;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField numero;
    private javax.swing.JTextField origem;
    private javax.swing.JLabel partidaLabel;
    private javax.swing.JTextField vagas;
    private javax.swing.JLabel vasgasLabel;
    // End of variables declaration//GEN-END:variables
}
